package com.ljxt.dt.util.xhq;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 徐浩钦
 * @version 1.0.0
 * @date 2020/5/12 10:49
 * @copyright 老九学堂T11
 */
public interface ResultSetConsumer<T> {

    Map<String,Object> resources = new LinkedHashMap<>();

    default Map<String,Object> getResources(){
        return resources;
    }

    default Map<String,Object> getResources(boolean isClear){
        if(isClear){
            resourcesClear();
        }
        return resources;
    }

    default void  resourcesClear(){
        resources.clear();
    }

    /**
     * 申请
     * @param rs
     * @return
     * @throws SQLException
     */
    T apply(ResultSet rs) throws SQLException;

    /**
     * 接受
     * @param object
     */
    Boolean accept(T object);

}
